
var ue = UE.getEditor('container',{
    toolbars: [[
        'fullscreen', 'source', '|', 'undo', 'redo', '|',
        'bold', 'italic', 'underline', 'fontborder', 'strikethrough', 'superscript', 'subscript', 'removeformat', 'formatmatch', 'autotypeset', 'blockquote', 'pasteplain', '|', 'forecolor', 'backcolor', 'insertorderedlist', 'insertunorderedlist', 'selectall', 'cleardoc', '|',
        'rowspacingtop', 'rowspacingbottom', 'lineheight', '|',
        'customstyle', 'paragraph', 'fontfamily', 'fontsize', '|',
        'justifyleft', 'justifycenter', 'justifyright', 'justifyjustify', '|',
        'simpleupload', 'insertimage',

    ]
    ]
});

function aaaa(file) {
    var prevDiv = document.getElementById('androimg');
    if (file.files && file.files[0])
    {
        var reader = new FileReader();
        reader.onload = function(evt){
            prevDiv.innerHTML = '<img src="' + evt.target.result + '" height="150" width="150"/>';
        }
        reader.readAsDataURL(file.files[0]);
    }
    else
    {
        prevDiv.innerHTML = '<div class="img" style="filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(sizingMethod=scale,src=\'' + file.value + '\'"></div>';
    }
}
$("#adtvmout").click(function () {
    window.location.href = '/notice';
});

$("#adtvmadd").click(function () {
    // var data = $("#adtvminfo").serialize();
    var data = new FormData($("#adtvminfo" )[0]);

    var id = $("input[name='id']").val();
    // var care_name = $(".care_name").val();
    // if(care_name==''){
    //     dshow("领养后照顾人不能为空");
    //     return false;
    // }
    $.ajax({
        url: '/notice/add',
        type: 'POST',
        data: data,
        dataType: 'JSON',
        async: false,
        cache: false,
        contentType: false,
        processData: false,
        success: function (json) {
            if (json.code == 2000) {
                if (id != '') {
                    history.back(-1);
                } else {
                    window.location.href = '/notice'
                }
            } else {
                dshow(json.message);
            }
        }
    });
});
